<!--
 * @Author: wjk
 * @Date: 2020-04-09 09:38:22
 * @LastEditors: wjk
 * @LastEditTime: 2020-08-31 15:02:54
 * @description: file content
-->

<template>
  <base-page-view class-name="page-container">
    <view class="top">
      <view class="top-bg">
        <b-image width="750" height="430" is-asset src="/static/images/mine/bg_earing_black.png" />
      </view>
      <view class="top-content">
        <view class="js_center price">{{ assistant.currentMonth | formatMoney }}</view>
        <view class="title js_center" @click="question">本月预估收益
          <image src="/static/images/icon/icon_question_white.png" class="question" />
        </view>
        <view class="js_center mention" @click="$navigateTo('/pagesCommission/earnings/monthIncome')">
          每月定期发放上月收益，查看明细
          <image class="regular" src="/static/images/icon/icon_arror_right_grey.png"></image>
        </view>
      </view>
    </view>
    <view v-if="false" class="center">
      <view class="todayEarnings">
        <view class="title">今日预估收益</view>
        <view class="info">
          <view class="price"><span class="icon">¥</span>{{ assistant.today | formatMoney }}</view>
          <view class="num">{{ assistant.todayNum ? assistant.todayNum : 0 }}笔</view>
        </view>
      </view>
      <view class="todayEarnings">
        <view class="title">昨日预估收益</view>
        <view class="info">
          <view class="price"><span class="icon">¥</span>{{ assistant.yestoday | formatMoney }}</view>
          <view class="num">{{ assistant.yestodayNum ? assistant.yestodayNum : 0 }}笔</view>
        </view>
      </view>
    </view>
    <view class="bottom">
      <view class="bottom_box" @click="$navigateTo('/pagesCommission/earnings/bills')">
        <view class="title">
          <image src="/static/images/commission/icon_history.png" class="list_icon" />
          历史每月账单
        </view>
        <view class="more">
          查看
          <image src="/static/images/commission/list_more.png" class="list_more" />
        </view>
      </view>
    </view>
    <view class="bottom">
      <view class="bottom_box" @click="$navigateTo('/pagesCommission/earnings/historyIncomes')">
        <view class="title">
          <image src="/static/images/commission/icon_money.png" class="list_icon" />
          累计收益详情
        </view>
        <view class="more">
          查看
          <image src="/static/images/commission/list_more.png" class="list_more" />
        </view>
      </view>
    </view>
  </base-page-view>
</template>

<script>
import './index.scss'
export default {
  components: {
  },
  data() {
    return {
      assistant: {}
    }
  },
  created() {
  },
  onLoad(option) {
    this.initData()
  },
  onShow() {
  },
  methods: {
    async initData() {
      const res = await this.$api.commissionApi.getUserEarning({ userId: this.$store.state.userInfo.uid })
      if (res.code === '000000') {
        this.assistant = res.data
      }
      console.log(res)
    },
    question() {
      const message = '指根据 "本月商品销售情况" 产生的预估收益。'
      this.$gc.$message({
        content: message,
        title: '本月预估收益',
        type: 'richText',
        showMessage: true,
        showCancel: false,
        confirmText: '好哒',
        align: 'center'
      })
    }
  }
}
</script>
